package ld.controller;

import ld.pojo.Dept;
import ld.service.DeptService;
import ld.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: Liudao
 * @Date: 2022-08-10-22:00
 * @Description:
 */
@Controller
@RequestMapping("/dept")
public class DeptController {
    @Autowired
    private DeptService deptService;

    @RequestMapping("/list")
    @ResponseBody
    public R list(){
        List<Dept> depts =  deptService.list();
        return R.ok().data("data",depts);
    }
}
